//
// Created by 吴锐 on 2022/2/26.
//

#include "iostream"
#include "fstream"

using namespace std;

void test01(){
    ifstream ifs;

    ifs.open("test.txt", ios::in);

    if(!ifs.is_open()){
        cout << "文件打开失败" << endl;
        return;
    }

//    char buf[1024] = {0};
//    while(ifs >> buf){
//        cout << buf << endl;
//    }

//    char buffer[1024] = {0};
//    while (ifs.getline(buffer, sizeof(buffer))){
//        cout << buffer << endl;
//    }

//    string buffer;
//    while(getline(ifs, buffer)){
//        cout << buffer << endl;
//    }

    char c;
    while ((c = ifs.get()) != EOF){
        cout << c;
    }

    ifs.close();
}

int main(){
    test01();
    return 0;
}